/************************************************
 * Copyright (c) 2007 ~ 2009, 
 * All rights reserved.
 * Version   : 1.0
 * Author    : lengsh@gmail.com 
 * Date      : 2007.12.6
 ***********************************************/

#ifndef _GONGFU_PANDA_FACADE_H_
#define _GONGFU_PANDA_FACADE_H_

#include <memory>
#include <vector>
#include <string>
#include <map>
#include "AntDefine.h"
#include "Facade.h"
#include "Network.h"
#include "Threads.h"

using namespace std;
class Handler;
class Facade 
{
	protected:
		struct settings m_settings;
		static Facade *_instance;
                Network m_network;
                Threads m_threads;
                Handler *m_handler;
 ///               ICache *m_pCache;
	public:
		/*********************************
		 * for event 
		 ********************************/
		struct event_base *main_base;
                int m_iTimer;

	public:
		struct settings *GetSettings( ){ return &m_settings; }
		Network *GetNetWork() { return &m_network; }
                Threads *GetThreads() { return &m_threads; }
                Handler *GetHandler() { return m_handler; }
		void Start( Handler *pH);
                static void Timer(int fd, short event, void *arg);
                static void DoTimer();
//                static bool GetTimerStatus();
//                static bool SetTimerStatus(bool status );
	protected:
		Facade();
		virtual ~Facade();
		void settings_init(void);
//                static pthread_mutex_t  m_timerLock;
//                static bool m_bTimer;

	public:
		static Facade *Instance();
};
#endif //_GONGFU_PANDA_RESOURCE_UTILS_H_

